import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useThemeStore = defineStore('theme', () => {
  const themeColor = ref('#409eff')

  function setThemeColor(color: string) {
    themeColor.value = color
    // 更新根元素的CSS变量
    document.documentElement.style.setProperty('--el-color-primary', color)
  }

  return { themeColor, setThemeColor }
})